Skip to content

feat: implement Or combinator#12

Merged
tisonkun merged 5 commits intomainfrom
or
Dec 8, 2025
Merged

feat: implement Or combinator#12
tisonkun merged 5 commits intomainfrom
or

Conversation

@tisonkun
Copy link
Copy Markdown
Contributor

@tisonkun tisonkun commented Dec 8, 2025

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements an "Or" combinator for the traversable visitor pattern, allowing developers to compose multiple visitors that execute sequentially on each node during traversal.

Key changes:

  • Added a new combinator module with VisitorExt and VisitorMutExt traits providing the or() method
  • Implemented OrVisitor struct that combines two visitors with short-circuit behavior on Break
  • Added comprehensive test coverage including normal execution and break scenarios

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
traversable/src/combinator.rs New module implementing visitor combinator traits and the OrVisitor type with proper short-circuit semantics
traversable/src/lib.rs Added public export of the new combinator module
traversable/tests/test_combinator.rs Comprehensive test suite covering sequential visitor execution, break behavior for both visitors, and mutable visitor composition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
@tisonkun tisonkun merged commit ff80199 into main Dec 8, 2025
9 checks passed
@tisonkun tisonkun deleted the or branch December 8, 2025 05:15
@tisonkun
Copy link
Copy Markdown
Contributor Author

tisonkun commented Dec 8, 2025

@andylokandy may be more proper to name it chain?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants